import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import ElementPlus from 'unplugin-element-plus/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

export default function createAutoImport() {
  return [
    AutoImport({
      imports: [
        'vue',
        'vue-router',
        'pinia',
        '@vueuse/core',
        // custom
        {
          axios: [
            // default imports
            ['default', 'axios'] // import { default as axios } from 'axios',
          ]
        }
      ],
      dts: false,
      eslintrc: {
        // when enabled=true Generate corresponding .eslintrc-auto-import.json file.
        enabled: false, // Default `false`, 生成之后改为false
        globalsPropValue: true
      },
      resolvers: [ElementPlusResolver()]
    }),
    Components({
      resolvers: [ElementPlusResolver()],
      dts: false
    }),
    // elementPlus按需引入样式处理
    ElementPlus({
      defaultLocale: 'zh-cn'
    })
  ]
}
